﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework;
using WarningForeverClone.src.ships;

namespace WarningForeverClone.src.ui
{
    /// <summary>
    /// Contains helper methods for dealing with the UI
    /// </summary>
    class UI
    {
        Dictionary<String, SpriteFont> fonts;

        int left, top, right, bottom;

        Vector2 topLeft, topRight, bottomLeft, bottomRight;
        Texture2D redLaser, blueLaser, greenlaser;

        public UI(int left, int top, int right, int bottom)
        {
            this.left = left;
            this.top = top;
            this.right = right;
            this.bottom = bottom;

            topLeft = new Vector2(left, top);
            topRight = new Vector2(right, top);
            bottomLeft = new Vector2(left, bottom);
            bottomRight = new Vector2(right, bottom);
        }

        public void LoadContent(ContentManager content)
        {
            fonts = new Dictionary<string, SpriteFont>();
            fonts.Add("Calibri14", content.Load<SpriteFont>("Fonts/Calibri14"));

            greenlaser = content.Load<Texture2D>("Textures/Weapons/greenLaser");
            blueLaser = content.Load<Texture2D>("Textures/Weapons/blueLaser");
            redLaser = content.Load<Texture2D>("Textures/Weapons/redLaser");
        }
        public void DrawAvailableWeapons(SpriteBatch sb, Ship player)
        {
            sb.DrawString(fonts["Calibri14"], "Weapons:", bottomLeft + new Vector2(20,-35), Color.White);

            if (player.SelectedWeapon == "greenLaser")
            {
                sb.Draw(greenlaser, bottomLeft + new Vector2(120, -50), Color.White);
                sb.Draw(blueLaser, bottomLeft + new Vector2(150, -50), Color.Gray);
                sb.Draw(redLaser, bottomLeft + new Vector2(180, -50), Color.Gray);
            }
            else if (player.SelectedWeapon == "blueLaser")
            {
                sb.Draw(greenlaser, bottomLeft + new Vector2(120, -50), Color.Gray);
                sb.Draw(blueLaser, bottomLeft + new Vector2(150, -50), Color.White);
                sb.Draw(redLaser, bottomLeft + new Vector2(180, -50), Color.Gray);
            }
            else if (player.SelectedWeapon == "redLaser")
            {
                sb.Draw(greenlaser, bottomLeft + new Vector2(120, -50), Color.Gray);
                sb.Draw(blueLaser, bottomLeft + new Vector2(150, -50), Color.Gray);
                sb.Draw(redLaser, bottomLeft + new Vector2(180, -50), Color.White);
            }
        }

        public Dictionary<String, SpriteFont> Fonts
        {
            get { return fonts; }
        }
    }
}
